﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserInformation.aspx.cs"
    Inherits="CURE.SystemManagement.userInformation" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript">
        $(document).ready(function () {
            
            var r1 = "<%=Radio %>"
              if (r1 != null) {
                  $("input[name=radSex]:eq(" + r1 + ")").attr("checked", 'checked');
              }
            //liudan add  12.14
              var r2 = "<%=IsEMailRadio %>"
              if (r2 != null) {
                  $("input[name=IsEmail]:eq(" + r2 + ")").attr("checked", 'checked');
              }

          });
          $(document).ready(function () {
              var groupId = "<%=Group %>";
              if (groupId != null && groupId != "") {
                  $("#txtGroup").attr("value", groupId);
              }
          });
          $(document).ready(function () {
              var deptId = "<%=Dept %>";
              if (deptId != null && deptId != "") {
                  $("#txtDept").attr("value", deptId);
              }
          });
          $(document).ready(function () {
              var jobId = "<%=Job %>";
              if (jobId != null && jobId != "") {
                  $("#SelectJob").attr("value", jobId);
              }
          });
          $(document).ready(function () {
              var sId = "<%=Skilllevel %>";
              if (sId != null && sId != "") {
                  $("#SelectSkilllevel").attr("value", sId);
              }
          });
          function checkUserid() {
              var reg = /[\u4E00-\u9FA5]/i; //非中文
              //var reg = /[^\x00-\xff]/g;//非中文以及中文输入法下符号
              var userid = document.getElementById("txtEmployeeNum").value;
              userid = userid.replace(/(^\s*)|(\s*$)/g, ''); //去掉前后空格
              if (userid != null && userid != "") {
                  if (reg.test(userid)) {
                      alertMsg.error('用户编号不能出现中文！');
                      $('#txtEmployeeNum').val('');
                      return false;
                  }
                  if (userid.length > 30) {
                      alertMsg.error('用户编号最多为30位数字！');
                      return false;
                  }
              }
              return true;
          }
          function checkUsername() {
              var reg = /\s/g; //非空格
              //var reg = /^[\u4E00-\u9FA5]+$/; //尽限中文
              var username = document.getElementById("txtName").value;
              username = username.replace(/(^\s*)|(\s*$)/g, ''); //去掉前后空格
              if (username != null && username != "") {
                  if (reg.test(username)) {
                      alertMsg.error('用户名称不能出现空格！');
                      $('#txtName').val('');
                      return false;
                  }
                  var l = getByteLen(username);
                  if (l > 20) {
                      alertMsg.error('用户名称最多为20位字符！(中文相当于2个字符)');
                      return false;
                  }
              }
              return true;
          }
          function checkUseremail() {
              var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; //邮箱
              var useremail = document.getElementById("txtEmail").value;
              useremail = useremail.replace(/(^\s*)|(\s*$)/g, ''); //去掉前后空格
              if (useremail != null && useremail != "") {
                  if (!reg.test(useremail)) {
                      alertMsg.error('邮箱格式不正确！');
                      $('#txtEmail').val('');
                      return false;
                  }
                  var l = getByteLen(useremail);
                  if (l > 40) {
                      alertMsg.error('邮箱最多为40位字符！');
                      return false;
                  }
              }
              return true;
          }
          function checkNum(fag) {
              var reg = /^[0-9]+?$/;
              var num = fag.value;
              //num = num.replace(/(^\s*)|(\s*$)/g, ''); //去掉前后空格
              if (num != null && num != "") {
                  if (!reg.test(num)) {
                      alertMsg.error('比例数应为非负整数！');
                      fag.value = "";
                      return false;
                  }
                  if (parseInt(num) > 100) {
                      alertMsg.error('比例数不能大于100！');
                      fag.value = "";
                      return false;
                  }
              }
              return true;
          }

          function checkTel(fag) {
              var reg = /^[0-9\-]+?$/;
              var num = fag.value;
              //num = num.replace(/(^\s*)|(\s*$)/g, ''); //去掉前后空格
              if (num != null && num != "") {
                  if (!reg.test(num)) {
                      alertMsg.error('电话只能由数字及‘-’组成！');
                      fag.value = "";
                      return false;
                  }
              }
              return true;
          }


          //获取字符位数，中文占两位字符
          function getByteLen(val) {
              var len = 0;
              for (var i = 0; i < val.length; i++) {
                  if (val[i].match(/[^\x00-\xff]/ig) != null) //全角
                      len += 2;
                  else
                      len += 1;
              }
              return len;
          }
    </script>
</head>
<body>
    <div class="pageContent">
        <form id="form1" name="form1" method="post" action="Handler/UserHandler.ashx" class="pageForm required-validate"
            onsubmit="return validateCallback(this, dialogAjaxDone)">
            <%--        <input type="hidden" name="txtid" value="<%=Master_id %>" />--%>
            <input type="hidden" name="action" value="<%=Action %>" />
            <div class="pageFormContent" layouth="56">
                <p>
                    <label>员工编号：</label>
                    <input type="text" id="txtid" runat="server" name="txtid" style="display: none;" value="<%=Master_id %>" />
                    <input type="text" id="txtEmployeeNum" runat="server" onblur="checkUserid();" name="txtEmployeeNum" size="30" maxlength="20" class="required" alt="请输入员工编号" value="<%=Master_userid %>" />
                </p>
                <p>
                    <label>
                        用户名：</label>
                    <input type="text" name="txtName" size="30" id="txtName" onblur="checkUsername();" maxlength="20" class="required" alt="请输入名称" value="<%=Master_name %>" />
                </p>
                <p>
                    <label>
                        性别：</label><input id="radMan" type="radio" name="radSex" value="1" checked="checked" />
                    男&nbsp;<input id="radWoman" type="radio" name="radSex" value="0" />女
                </p>

                <p>
                    <label>
                        所属部门：</label>
                    <select name="txtDept" id="txtDept" style="width: 180px;">
                        <asp:Repeater runat="server" ID="reptDept">
                            <ItemTemplate>
                                <option value="<%#Eval("dept_id") %>"><%#Eval("dept_name")%></option>
                            </ItemTemplate>
                        </asp:Repeater>
                    </select>
                </p>
                <p>
                    <label>
                        电子邮箱：</label>
                    <input type="text" name="txtEmail" size="30" maxlength="40" onblur="checkUseremail();" id="txtEmail" alt="请输入电子邮箱" value="<%=Master_email %>" />
                </p>
                <p>
                    <label>
                        是否发送邮件：</label><input id="radioM1" type="radio" name="IsEmail" value="0" checked="checked" />
                    是&nbsp;<input id="radioM2" type="radio" name="IsEmail" value="1" />否
                </p>
                <p>
                    <label>电话：</label>
                    <input type="text" name="txtTel" size="30" maxlength="15" id="txtTel" onblur="checkTel(this);" alt="请输入电话" value="<%=Master_tel %>" />
                </p>
                <p>
                    <label>用户角色：</label>
                    <select name="txtGroup" id="txtGroup" style="width: 180px;">
                        <asp:Repeater runat="server" ID="reptGroup">
                            <ItemTemplate>
                                <option value="<%#Eval("group_id") %>"><%#Eval("group_name")%></option>
                            </ItemTemplate>
                        </asp:Repeater>
                    </select>
                </p>
                <p>
                    <label>职务：</label>
                    <select name="SelectJob" id="SelectJob" style="width: 180px;">
                        <asp:Repeater runat="server" ID="reptJob">
                            <ItemTemplate>
                                <option value="<%#Eval("code") %>"><%#Eval("name")%></option>
                            </ItemTemplate>
                        </asp:Repeater>
                    </select>
                </p>
                <%-- <p>
               <label>职能等级：</label>
               <select name="SelectSkilllever" id="SelectSkilllevel" style="width: 180px;">
               <option value="">-请选择-</option>
                   <asp:Repeater runat="server" ID="reptSkilllevel">
                        <ItemTemplate>
                         <option value="<%#Eval("code") %>"><%#Eval("code")%></option>
                        </ItemTemplate>
                     </asp:Repeater>
                </select>
            </p>
            <p>
                <label>岗位技能(运输)：</label>
                <input type="text" name="txtTransport" size="30" maxlength="3"  id="txtTransport" onblur="checkNum(this);" class="number" alt="请输入百分比" value="<%=Skill_transport %>" />
            </p>
            <p>
                <label>岗位技能(包装)：</label>
                <input type="text" name="txtPackaging" size="30" maxlength="3"  id="txtPackaging" onblur="checkNum(this);" class="number" alt="请输入百分比" value="<%=Skill_packaging %>" />
            </p>
            <p>
                <label>岗位技能(发货)：</label>
                <input type="text" name="txtShipments" size="30" maxlength="3"  id="txtShipments" onblur="checkNum(this);" class="number" alt="请输入百分比" value="<%=Skill_shipments %>" />
            </p>--%>
            </div>
            <div class="formBar">
                <ul>
                    <li>
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="submit">
                                    提交</button>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="button">
                            <div class="buttonContent">
                                <button type="reset" class="close">
                                    取消</button>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </form>
    </div>
</body>
</html>
